//
// Created by alexa on 5/13/2024.
//

#ifndef ARTILLERYSYSTEM_CREWREPOSITORY_H
#define ARTILLERYSYSTEM_CREWREPOSITORY_H


#include "../../entities/maintenance-crew/MaintenanceCrew.h"
#include "../../entities/_identifiable/IdentifiableList.h"

class CrewRepository {
private:
    IdentifiableList<MaintenanceCrew> source;

    string fileSourcePath;
public:
    explicit CrewRepository(const string &fileSourcePath = "crews.json");

    virtual ~CrewRepository();

    void setFileSourcePath(const string &fileSourcePath);

    const string &getFileSourcePath() const;

    MaintenanceCrew *findById(string id);

    void save(MaintenanceCrew *crew);

    void deleteOne(MaintenanceCrew *crew);

    vector<MaintenanceCrew *> findAll();

    void loadDataFromFile();

    void saveDataToFile();
};


#endif //ARTILLERYSYSTEM_CREWREPOSITORY_H
